<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Fabrice
 * Date: 26/02/14
 * Time: 16:35
 * To change this template use File | Settings | File Templates.
 */

class ControleurNews {

    public function ControleurNews()
    {
        require_once (Chemins::MODELES.'ModeleNews.class.php');
    }

    public function afficherFormAjout()
    {
        VariablesGlobales::$nextAction = "ajouter";
        include_once (Chemins::VUES.'v_FormNews.php');
    }

    public function ajouter()
    {
        if (ModeleNews::insertNews($_REQUEST['titre'], $_REQUEST['texte'], Tools::datePHPVersBDD(time())))
        {
            VariablesGlobales::$message = "La news a bien été rajoutée.";
            include_once (Chemins::VUES.'v_MessageValidation.php');
        }
        else
        {
            VariablesGlobales::$message = "Echec de l'Ajout";
            include_once (Chemins::VUES.'v_MessageErreur.php');
        }
    }
}